Kanzi 3.9.10
kanzi::AbstractBindingRuntime Class Referenceabstract

Base class for binding runtimes. More...

#include <kanzi/core.ui/binding/abstract_binding_runtime.hpp>

Inheritance diagram for kanzi::AbstractBindingRuntime:
[legend]

Public Types

enum  AttachmentState {
  Detached , Detaching , Attaching , Attached ,
  Removed
}
 Attachment state for keeping track current status. More...
 

Public Member Functions

void attach ()
 Attach the binding.
 
void detach ()
 Detaches the binding.
 
void detachIfAttachedOrAttaching ()
 Detaches the binding if it is attaching or attached.
 
AbstractBindingSharedPtr getBinding () const
 Returns the binding associated with this binding runtime.
 
BindingLookupContextgetLookupContext () const
 Gets the lookup context.
 
shared_ptr< voidgetOwner () const
 Gets the owner.
 
BindingSourceRuntimegetSourceRuntime () const
 Gets the source runtime.
 
BindingTargetRuntimegetTargetRuntime () const
 Gets the target runtime.
 
bool isAttached () const
 Indicates whether this binding runtime has been attached.
 
bool isAttaching () const
 Indicates whether this binding runtime is being attached.
 
bool isConnected ()
 Indicates whether this binding runtime is connected.
 
bool isDetached () const
 Indicates whether this binding runtime is detached.
 
bool isDetaching () const
 Indicates whether this binding runtime is being detached.
 
bool isRemoved () const
 Gets whether the binding runtime has been removed from the binding host.
 
void notifySourceChanged ()
 Called when binding source has changed.
 
void notifyTargetChanged ()
 Called when binding target has changed.
 
void onRemoved ()
 Called when binding is being removed from where it has been installed.
 
void removeFromHost ()
 Removes the binding runtime from the binding host.
 
void setHost (BindingHostConceptSharedPtr hostObject)
 Sets the binding host object in which the binding runtime is hosted.
 
void setOwner (shared_ptr< void > owner)
 Set the owner.
 
bool update ()
 Execute the binding.
 
virtual ~AbstractBindingRuntime ()
 Destructor.
 

Protected Member Functions

 AbstractBindingRuntime (AbstractBindingSharedPtr binding, BindingLookupContextPtr lookupContext, BindingSourceRuntimePtr sourceRuntime, BindingTargetRuntimePtr targetRuntime)
 Constructor.
 
virtual void attachOverride ()=0
 Binding-dependent attach.
 
virtual void detachOverride ()=0
 Binding-dependent detach.
 
virtual bool isConnectedOverride ()
 Binding-dependent attached indication.
 
virtual void notifySourceChangedOverride ()
 Binding-dependent source change.
 
virtual void notifyTargetChangedOverride ()
 Binding-dependent target change.
 
bool readFromSource (Variant &value)
 Read from source and execute forward validators.
 
bool readFromTarget (Variant &value)
 Reads from target and executes reverse validators.
 
virtual bool updateOverride ()=0
 Binding-dependent update.
 
bool writeToSource (const Variant &value) const
 Writes to source.
 
bool writeToTarget (const Variant &value)
 Write to target.
 

Protected Attributes

AttachmentState m_attachmentState
 Current binding runtime state.
 
AbstractBindingSharedPtr m_binding
 Associated binding.
 
BindingHostConceptWeakPtr m_bindingHost
 The binding host object in which the binding runtime is hosted.
 
BindingLookupContextPtr m_lookupContext
 
weak_ptr< voidm_owner
 Owner for tagging the runtime.
 
BindingSourceRuntimePtr m_sourceRuntime
 Runtime for source.
 
BindingTargetRuntimePtr m_targetRuntime
 Runtime for target.
 

Detailed Description

Base class for binding runtimes.

Bindings create abstract binding runtimes to serve as the runtime data of the bindings. Binding runtimes refer to their source bindings, but do not alter them.

Distinct binding implementations create objects of classes inheriting the base AbstractBindingRuntime.

When you remove a binding runtime from a binding host, Kanzi detaches the binding and makes the binding runtime unusable.

See also
AbstractBinding
Since
Kanzi 3.7.0

Member Enumeration Documentation

◆ AttachmentState

Attachment state for keeping track current status.

Enumerator
Detached 

Detached.

Detaching 

Detaching.

Set after detach is called, but not yet completed.

Attaching 

Attaching.

Set after attach is called, but not yet completed.

Attached 

Attached.

Removed 

Removed.

Constructor & Destructor Documentation

◆ ~AbstractBindingRuntime()

virtual kanzi::AbstractBindingRuntime::~AbstractBindingRuntime ( )
virtual

Destructor.

◆ AbstractBindingRuntime()

kanzi::AbstractBindingRuntime::AbstractBindingRuntime ( AbstractBindingSharedPtr binding,
BindingLookupContextPtr lookupContext,
BindingSourceRuntimePtr sourceRuntime,
BindingTargetRuntimePtr targetRuntime )
explicitprotected

Constructor.

Abstract binding runtime takes ownership of both source and target runtimes.

Parameters
bindingHost binding to keep a reference to.
lookupContextLookup context.
sourceRuntimeSource runtime.
targetRuntimeTarget runtime.
Since
Kanzi 3.9.6 Added BindingLookupContextPtr.

Member Function Documentation

◆ attach()

void kanzi::AbstractBindingRuntime::attach ( )

Attach the binding.

Attaches source and target.

◆ detach()

void kanzi::AbstractBindingRuntime::detach ( )

Detaches the binding.

Detaches all sources and target

◆ detachIfAttachedOrAttaching()

void kanzi::AbstractBindingRuntime::detachIfAttachedOrAttaching ( )

Detaches the binding if it is attaching or attached.

◆ onRemoved()

void kanzi::AbstractBindingRuntime::onRemoved ( )

Called when binding is being removed from where it has been installed.

Automatically called on binding target runtime destruction, but also called manually when binding is being removed from a Node or RenderPass to remove potential installed value sources.

◆ notifySourceChanged()

void kanzi::AbstractBindingRuntime::notifySourceChanged ( )

Called when binding source has changed.

Usually called by binding sources that notify the binding runtime of the change.

◆ notifyTargetChanged()

void kanzi::AbstractBindingRuntime::notifyTargetChanged ( )

Called when binding target has changed.

This should not be called for most bindings, as they only work in one direction.

◆ update()

bool kanzi::AbstractBindingRuntime::update ( )

Execute the binding.

Performs read from the source and write to the target.

Returns
True if both read and write succeeded.

◆ getOwner()

shared_ptr< void > kanzi::AbstractBindingRuntime::getOwner ( ) const
inline

Gets the owner.

Returns
Shared pointer to the owner.

◆ setOwner()

void kanzi::AbstractBindingRuntime::setOwner ( shared_ptr< void > owner)
inline

Set the owner.

Parameters
ownerShared pointer to owner.

◆ getBinding()

AbstractBindingSharedPtr kanzi::AbstractBindingRuntime::getBinding ( ) const
inline

Returns the binding associated with this binding runtime.

Returns
Shared pointer to binding.

◆ isAttached()

bool kanzi::AbstractBindingRuntime::isAttached ( ) const
inline

Indicates whether this binding runtime has been attached.

Returns
True if attached, false otherwise.

◆ isAttaching()

bool kanzi::AbstractBindingRuntime::isAttaching ( ) const
inline

Indicates whether this binding runtime is being attached.

Returns
True if attaching, false otherwise.

◆ isDetached()

bool kanzi::AbstractBindingRuntime::isDetached ( ) const
inline

Indicates whether this binding runtime is detached.

Returns
True if detached, false otherwise.

◆ isDetaching()

bool kanzi::AbstractBindingRuntime::isDetaching ( ) const
inline

Indicates whether this binding runtime is being detached.

Returns
True if detaching, false otherwise.

◆ isConnected()

bool kanzi::AbstractBindingRuntime::isConnected ( )
inline

Indicates whether this binding runtime is connected.

Attaching a binding causes it to be potentially connected.

Returns
True if connected, false if not connected.

◆ getSourceRuntime()

BindingSourceRuntime * kanzi::AbstractBindingRuntime::getSourceRuntime ( ) const
inline

Gets the source runtime.

Returns
Pointer to source runtime.

◆ getTargetRuntime()

BindingTargetRuntime * kanzi::AbstractBindingRuntime::getTargetRuntime ( ) const
inline

Gets the target runtime.

Returns
Pointer to target runtime.

◆ setHost()

void kanzi::AbstractBindingRuntime::setHost ( BindingHostConceptSharedPtr hostObject)

Sets the binding host object in which the binding runtime is hosted.

Parameters
hostObjectThe binding host object in which the binding runtime is hosted.
Since
Kanzi 3.9.0

◆ removeFromHost()

void kanzi::AbstractBindingRuntime::removeFromHost ( )

Removes the binding runtime from the binding host.

When you remove a binding from a host, Kanzi detaches the binding runtime and makes the binding runtime unusable.

Since
Kanzi 3.9.0

◆ isRemoved()

bool kanzi::AbstractBindingRuntime::isRemoved ( ) const

Gets whether the binding runtime has been removed from the binding host.

Returns
If the binding runtime has been removed from the binding host, true, otherwise false.
Since
Kanzi 3.9.0

◆ getLookupContext()

BindingLookupContext & kanzi::AbstractBindingRuntime::getLookupContext ( ) const
inline

Gets the lookup context.

Returns
lookup context

◆ attachOverride()

virtual void kanzi::AbstractBindingRuntime::attachOverride ( )
protectedpure virtual

◆ detachOverride()

virtual void kanzi::AbstractBindingRuntime::detachOverride ( )
protectedpure virtual

◆ readFromSource()

bool kanzi::AbstractBindingRuntime::readFromSource ( Variant & value)
protected

Read from source and execute forward validators.

Parameters
valueValue to read to.
Returns
True if read and validators succeeded.

◆ readFromTarget()

bool kanzi::AbstractBindingRuntime::readFromTarget ( Variant & value)
protected

Reads from target and executes reverse validators.

Parameters
valueValue to read to.
Returns
True if read and validators succeeded.

◆ writeToTarget()

bool kanzi::AbstractBindingRuntime::writeToTarget ( const Variant & value)
protected

Write to target.

Parameters
valueValue to write.
Returns
True if write and validators succeeded.

◆ writeToSource()

bool kanzi::AbstractBindingRuntime::writeToSource ( const Variant & value) const
protected

Writes to source.

Parameters
valueValue to write.
Returns
True if write succeeded.

◆ notifySourceChangedOverride()

virtual void kanzi::AbstractBindingRuntime::notifySourceChangedOverride ( )
protectedvirtual

Binding-dependent source change.

Default implementation simply calls update() on the forward direction.

Reimplemented in kanzi::ExpressionBindingRuntime, kanzi::ManualBindingRuntime, and kanzi::ToSourceBindingRuntime.

◆ notifyTargetChangedOverride()

virtual void kanzi::AbstractBindingRuntime::notifyTargetChangedOverride ( )
protectedvirtual

Binding-dependent target change.

Default implementation of throws an exception.

Reimplemented in kanzi::ToSourceBindingRuntime, and kanzi::TwoWayBindingRuntime.

◆ updateOverride()

virtual bool kanzi::AbstractBindingRuntime::updateOverride ( )
protectedpure virtual

Binding-dependent update.

Returns
True if both read and write succeeded.

Implemented in kanzi::BindingBaseRuntime, kanzi::ExpressionBindingRuntime, kanzi::ManualBindingRuntime, and kanzi::ToSourceBindingRuntime.

◆ isConnectedOverride()

virtual bool kanzi::AbstractBindingRuntime::isConnectedOverride ( )
protectedvirtual

Binding-dependent attached indication.

Default implementation checks source and target.

Returns
True if both source and target are connected, false otherwise.

Reimplemented in kanzi::ToSourceBindingRuntime.

Member Data Documentation

◆ m_binding

AbstractBindingSharedPtr kanzi::AbstractBindingRuntime::m_binding
protected

Associated binding.

◆ m_lookupContext

BindingLookupContextPtr kanzi::AbstractBindingRuntime::m_lookupContext
protected

◆ m_sourceRuntime

BindingSourceRuntimePtr kanzi::AbstractBindingRuntime::m_sourceRuntime
protected

Runtime for source.

◆ m_targetRuntime

BindingTargetRuntimePtr kanzi::AbstractBindingRuntime::m_targetRuntime
protected

Runtime for target.

◆ m_attachmentState

AttachmentState kanzi::AbstractBindingRuntime::m_attachmentState
protected

Current binding runtime state.

A binding runtime may be attached even if it is not connected. Attach is only called once.

◆ m_owner

weak_ptr<void> kanzi::AbstractBindingRuntime::m_owner
protected

Owner for tagging the runtime.

◆ m_bindingHost

BindingHostConceptWeakPtr kanzi::AbstractBindingRuntime::m_bindingHost
protected

The binding host object in which the binding runtime is hosted.


The documentation for this class was generated from the following file: